<?php 
include('../Connections/KRAPPERCON.php');
//include('../Connections/Accesos.php');

$select = getVal('select');
$return = getVal('return');
$container = getVal('container');
//exit;
?>

<div><input type='button' value="Buscar" onClick="searchListVlc()" /></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>Nro de VIN</td>
    <td><input name="t_lv_vin" type="text" id="t_lv_vin" size="30" maxlength="20"></td>
    <td>Nro de Placa</td>
    <td>
      <input name="t_lv_placa" type="text" id="t_lv_placa" size="15" maxlength="10">
    </td>
  </tr>
  <tr>
    <td>Cliente</td>
    <td>
      <input name="t_lv_cli" type="text" id="t_lv_cli" size="15" maxlength="10">
    </td>
    <td>Marca</td>
    <td>
      <select name="cb_lv_marca" id="cb_lv_marca">
      <option value=""></option>
       <?php 
	  include ('../Query_Min/getmarcas.php');
	  ?>
      </select>
    </td>
  </tr>
  <tr>
    <td>Nro de Motor</td>
    <td>
      <input name="t_lv_motor" type="text" id="t_lv_motor" size="18" maxlength="10">
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="4"><div id="d_res_vlc"></div>
    
    <?php if ($select == 'X'){
	?>
    <div align="right" style="margin-right:20px"><input type="button" value="Aceptar" onclick="selVlc()"/></div>
    <?php 
	}
	?></td>
  </tr>
</table>
<script type="text/javascript">
function searchListVlc(){
	$("#d_res_vlc").loadx('Consultas/Opers/queryVlc.php',
	{
		oper : 'query',
		serie : GEBI('t_lv_serie').value,
		placa : GEBI('t_lv_placa').value,
		vin : GEBI('t_lv_vin').value,
		motor : GEBI('t_lv_motor').value,
		marca : GEBI('cb_lv_marca').value,
		cliente : GEBI('t_lv_cli').value,
		'select' : '<?php echo $select;?>'
	}
	);
}

function selVlc(){
	<?php
	if ($select=='X'){
	?>	
	$(".clsRbVlc").each(function(){
		if (this.checked){
			var fila = $(this).parent().parent();
			var ser = fila.find('.clsSer').html();
			var pla = fila.find('.clsPla').html();
			var mot = fila.find('.clsMot').html();
			var mar = fila.find('.clsMar').html();
			var veh = {
				serie : ser,
				motor : mot,
				placa : pla,
				marca : mar,
				container : '<?php echo $container;?>'
			};
			<?php echo $return."(";?>veh<?php echo ");";?>;
		}
	});
	<?php 
	}
	?>
	
}
</script>